package com.test.design.pattern.factory.simple_factory;

/**
 * @ClasName SimpleCoffeeFactory
 * @Descripution TODO
 * @Author leikw
 * @Date 2021/11/6 17:08
 * @Version V1.0
 */
public class SimpleCoffeeFactory {

    public  Coffee createCoffee(String type){
        Coffee coffee = null;
        if("american".equals(type)) {
            coffee = new AmericanCoffee();
        } else if("latte".equals(type)) {
            coffee = new LatteCoffee();
        } else {
            throw new RuntimeException("对不起，您所点的咖啡没有");
        }
        return coffee;
    }
}
